package com.dingup.mock.service.impl;

import com.dingup.mock.enums.MarkTypeEnum;
import com.dingup.mock.feign.client.HomeworkFeignClient;
import com.dingup.mock.service.HomeworkRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * Created by wancheng on 2018/11/12.
 */
@Service
public class HomeworkRecordServiceImpl implements HomeworkRecordService {

    @Autowired
    HomeworkFeignClient homeworkFeignClient;

    @Override
    @Async
    public void updateTeacherCorrect(Integer homeworkRecordId, String examId, Integer examIdentity, Date endTime) {
        homeworkFeignClient.updateTeacherCorrect(homeworkRecordId, examId, examIdentity, endTime);
    }

    @Override
    public void updateTeacherCorrectStatus(Integer homeworkRecordId, MarkTypeEnum type) {
        homeworkFeignClient.updateCorrectHomeworkStatus(homeworkRecordId, type);
    }

    @Override
    public void saveHomeworkProgress(Integer homeworkRecordId, Integer homeworkQuestionNum, Integer id, String examId, Integer correct, Integer total) {
        homeworkFeignClient.saveHomeworkProgress(homeworkRecordId, homeworkQuestionNum, id, examId, correct, total);
    }

    @Override
    public Integer getHomeworkIdByHomeworkRecordId(Integer homeworkRecordId) {
        return homeworkFeignClient.getHomeworkIdByHomeworkRecordId(homeworkRecordId);
    }
}
